package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.pojo.TbContentCategoryExample;
import com.dongdongshop.service.TbContentCategoryServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbContentCategoryServiceImpl implements TbContentCategoryServiceI {

    @Autowired
    private TbContentCategoryMapper tbContentCategoryMapper;

    @Override
    @Transactional //事物
    public List<TbContentCategory> getFindAlls(String name) {
        return tbContentCategoryMapper.getFindAlls(name);
    }

    @Override
    @Transactional //事物
    public TbContentCategory selectTbContentCategoryById(Long id) {
        return tbContentCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional //事物
    public void updateTbContentCategory(TbContentCategory tbContentCategory) {
        tbContentCategoryMapper.updateByPrimaryKeySelective(tbContentCategory);
    }

    @Override
    @Transactional //事物
    public void saveTbContentCategory(TbContentCategory tbContentCategory) {
        tbContentCategoryMapper.insertSelective(tbContentCategory);
    }

    @Override
    @Transactional //事物
    public void deleteTbContentCategory(List<Integer> list) {
        for (Integer id : list){
            tbContentCategoryMapper.deleteByPrimaryKey(id.longValue());
        }
    }

    @Override
    public List<TbContentCategory> getFidAll() {
        return tbContentCategoryMapper.selectByExample(new TbContentCategoryExample());
    }
}
